package com.cheng.controller;

import com.cheng.common.exception.CommonException;
import com.cheng.common.results.DataRslt;
import com.cheng.data.vo.AcceptInfoVO;
import com.cheng.data.vo.ReqPageInfoVO;
import com.cheng.data.vo.RespPageInfoVO;
import com.cheng.operation.AcceptInfoOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: ChengJW
 * @date: 2021/9/20 23:39
 * @version: 1.0
 * @description: 业务流程-受理管理 页面请求处理类
 */
@Controller
public class AcceptAdminController extends BaseController{

    private final static Logger logger = LoggerFactory.getLogger(AcceptAdminController.class);

    @Autowired
    private AcceptInfoOperation acceptInfoOperation;

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/9/22
    * @description: 跳转至 业务流程-受理管理页面
    */
    @RequestMapping("/business/acceptAdmin")
    public String acceptAdmin() throws CommonException {
        return "acceptAdmin";
    }

    /**
    * @author: ChengJW
    * @params: [vo, req]
    * @return: com.cheng.common.utils.DataRslt
    * @date: 2021/9/23
    * @description: 查询受理信息列表
    */
    @RequestMapping("/business/acceptAdmin/selectAcceptInfo")
    @ResponseBody
    public DataRslt selectAcceptInfoList(ReqPageInfoVO vo) throws CommonException {

        vo.setUserCode(getUrCode());
        RespPageInfoVO respPageInfoVO = acceptInfoOperation.selectAcceptInfoList(vo);
        if (respPageInfoVO != null) {
            return tabSuccess(respPageInfoVO);
        }else {
            return tabFailure();
        }
    }

    /**
    * @author: ChengJW
    * @params: [vo]
    * @return: com.cheng.common.utils.DataRslt
    * @date: 2021/9/23
    * @description: 根据条件，修改 受理信息表中的捆号或页数
    */
    @RequestMapping("/business/acceptAdmin/updateAcceptInfo")
    @ResponseBody
    public DataRslt updateAcceptInfo(AcceptInfoVO vo) throws CommonException{
        acceptInfoOperation.updateAcceptInfo(vo);
        return success();
    }

    /**
    * @author: ChengJW
    * @params: [vo]
    * @return: com.cheng.common.utils.DataRslt
    * @date: 2021/9/29
    * @description: 删除指定的受理信息
    */
    @RequestMapping("/business/acceptAdmin/deleteAcceptInfo")
    @ResponseBody
    public DataRslt deleteAcceptInfo(AcceptInfoVO vo) throws CommonException{
        acceptInfoOperation.deleteAcceptInfo(vo);
        return success();
    }
}
